Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revset: add diff_contains(text[, files]) to search diffs #4100

Merged
merged 4 commits into from
Jul 17, 2024

Conversation

yuja
Copy link
Collaborator

@yuja yuja commented Jul 16, 2024

#2933

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added tests to cover my changes

yuja added 4 commits July 17, 2024 18:58
New diff_contains() revset function will use this helper.
Commit object extraction is common across predicate functions.
We should probably add error propagation path to Revset iterator, and predicate
functions will return Result<bool, RevsetEvaluationError>.
The text pattern is applied prior to comparison as we do in Mercurial. This
might affect hunk selection, but is much faster than computing diff of full
file contents. For example, the following hunk wouldn't be caught by
diff_contains("a") because the line "b\n" is filtered out:

    - a
      b
    + a

Closes jj-vcs#2933
@yuja yuja force-pushed the push-rsxzppmzrpok branch from 08660e6 to 9e7e1d4 Compare July 17, 2024 10:02
Copy link
Member

@martinvonz martinvonz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks.

We won't be able to support this at Google for a while but that's fine. It seems reasonable to eventually support it by creating some indexes.

@yuja yuja merged commit 895eead into jj-vcs:main Jul 17, 2024
17 checks passed
@yuja yuja deleted the push-rsxzppmzrpok branch July 17, 2024 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants